package com.jill.AOP;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class RecordingTimeAspect{


    private static final Logger log = LoggerFactory.getLogger(RecordingTimeAspect.class);

    @Around("execution(* com.jill.Controller.*.*(..))")
    public Object recordTime(ProceedingJoinPoint joinPoint) throws Throwable{

        long begin=System.currentTimeMillis();

        Object proceed = joinPoint.proceed();

        long end=System.currentTimeMillis();

        log.info("方法执行时间：{}ms",end-begin);

        return proceed;
    }

}
